<script setup>
import Avatar from '@/components/avatar/index.vue'
import IconSimple from '@/components/icon-simple/index.vue'
import AccessIntercept from '@/components/access-intercept/index.vue'
import {navigateTo} from '@/utils/uni-api-wrap/route'
import {useUserStore} from '@/stores/user'
import {tip} from '@/utils/uni-api-wrap/toast'
import {previewImage} from '@/utils/uni-api-wrap/media'

const userStore = useUserStore()

const showBusinessCard = () => {
  if (!userStore.userinfo?.businessCard) {
    return tip('还没有名片哦')
  }
  // 全屏预览
  previewImage([userStore.userinfo?.businessCard])
  // previewImage(['http://staticservice.public.qingquan.website:1280/Picture/pap.er/EzTGFKfEdmM.jpg'])
}

</script>

<template>
  <access-intercept>
    <view class="mine-page-container">
      <view class="header__container flex-row">
        <avatar :url="userStore.userinfo?.avatar || '/static/images/page-images/logo.png'" name="anonymous" />
<!--        <view class="header__context">-->
<!--          <view class="header__username">{{ userStore.userinfo?.nickname }}</view>-->
<!--          <view class="header__phone">{{ userStore.userinfo?.phone }}</view>-->
<!--          <view class="header__tag">{{ userStore.userinfo?.duties }}</view>-->
<!--        </view>-->
<!--        <view>-->
<!--          <tag size="small"><icon-simple name="home" />查看更多<icon-simple name="next" /></tag>-->
<!--        </view>-->
      </view>
      <view class="container">
        <view class="container__title">账户信息</view>
        <view class="list__container">
          <view class="list-item__container" @click="() => navigateTo('/pages/mine/approval-list')">
            <icon-simple name="message2" :size="50"></icon-simple>
            <view class="list-item__title">审批信息</view>
            <view class="list-item__subtitle">点击查看</view>
          </view>
          <view class="list-item__container" @click="() => navigateTo('/pages/mine/sign-list')">
            <icon-simple name="message3" :size="50"></icon-simple>
            <view class="list-item__title">签到信息</view>
            <view class="list-item__subtitle">点击查看</view>
          </view>
          <view class="list-item__container" @click="showBusinessCard">
            <icon-simple name="visiting-card" :size="50"></icon-simple>
            <view class="list-item__title">名片</view>
            <view class="list-item__subtitle">公司介绍</view>
          </view>
          <view class="list-item__container" @click="() => navigateTo('/pages/about/index')">
            <icon-simple name="custom2" :size="50"></icon-simple>
            <view class="list-item__title">关于我们</view>
            <view class="list-item__subtitle">联系方式</view>
          </view>
        </view>
      </view>
    </view>
  </access-intercept>
</template>

<style scoped lang="scss">
.header__container {
  position: relative;
  padding: 130rpx 25rpx 160rpx 42rpx;
  background-color: #2B8CF7;
  .header__context {
    flex: 1;
    margin-left: 25rpx;
    .header__username {
      @include fs36w600;
      text-align: left;
    }
    .header__phone {
      @include fs28w400($kaoyan-color-9);
      text-align: left;
    }
    .header__tag {
      @include fs32w400;
      text-align: left;
    }
  }
  &:after {
    position: absolute;
    content: '证件';
    left: 0;
    right: 0;
    bottom: 0;
    height: 74rpx;
    @include fs36w500(#fff);
    line-height: 74rpx;
    border-radius: 60rpx 60rpx 0 0;
    background-color: #03A8D1FF;
    border-bottom: 30rpx solid #F2F2F2;
    overflow: hidden;
  }
}
.container {
  padding: 20rpx;
  .container__title {
    @include fs36w600;
    text-align: left;
  }
  .list__container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    .list-item__container {
      flex: 0 0 340rpx;
      box-sizing: border-box;
      padding: 30rpx 0 40rpx 64rpx;
      margin-top: 30rpx;
      box-shadow: 0 4rpx 14rpx -2rpx rgba(0, 0, 0, 0.1);
      border-radius: 10rpx;
      overflow: hidden;
      .list-item__title {
        @include fs32w500;
        text-align: left;
      }
      .list-item__subtitle {
        @include fs28w400;
        text-align: left;
      }
    }
  }
}
</style>
